<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8" />
        <meta name="description" content="对网页的一段概括性描述"/>
        <meta name="keywords" content="关键字1,关键字2,关键字3..."/>
        <meta name="renderer" content="webkit">
        <title>Hiring-公司注册</title>
         <%@ include file="/WEB-INF/view/common/import.jsp"%>
        
   <style>
.error{
	color:red;
}
</style>
   
    </head>
    <body>
	 		<div class="container">
		<ol class="breadcrumb">
			<li class="active">公司注册</li>
		</ol>
		<c:if test="${! empty param.result }">
			<div class="alert alert-warning alert-dismissible fade in"
				role="alert">
				<button type="button" class="close" data-dismiss="alert">
					<span aria-hidden="true">×</span><span class="sr-only">Close</span>
				</button>
				<strong>注册失败失败!</strong>
			</div>
		</c:if>
		<form class="form-horizontal" role="form"  id="commentForm" action="CompanyServlet?command=register"
			method="POST">
			<div class="form-group">
				<label for="code" class="col-sm-2 control-label">账　　号：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" id="addcode" autofocus="autofocus"
						name="code"  placeholder="请输入账号" required onblur="selectCode(this)" >
				</div>
			</div>
			
			<div class="form-group">
				<label for="password" class="col-sm-2 control-label">密　　码：</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" 
						name="password"  placeholder="请输入密码" required>
				</div>
			</div>
			<div class="form-group">
				<label for="companyname" class="col-sm-2 control-label">公司名称：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" 
						name="companyname" placeholder="请输入公司名称" required>
				</div>
			</div>
			<div class="form-group">
				<label for="email" class="col-sm-2 control-label">邮箱：</label>
				<div class="col-sm-10">
					<input type="email" class="form-control" 
						name="email"  id="cemail" placeholder="请输入邮箱" required>
				</div>
			</div>
			<div class="form-group">
				<label for="phone" class="col-sm-2 control-label">电话：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" 
						name="phone" placeholder="请输入电话"  required>
				</div>
			</div>
			<div class="form-group">
				<label for="linkman" class="col-sm-2 control-label">联系人：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" 
						name="linkman" placeholder="请输入联系人"  required>
				</div>
			</div>
			<div class="form-group">
				<label for="address" class="col-sm-2 control-label">公司地址：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" 
						name="address" placeholder="请输入公司地址" required>
				</div>
			</div>
			<div class="form-group">
				<label for="numbers" class="col-sm-2 control-label">公司人数：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" 
						name="numbers" placeholder="请输入公司人数" required>
				</div>
			</div>
			<div class="form-group">
				<label for="slogan" class="col-sm-2 control-label">公司服务宗旨：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" 
						name="slogan" placeholder="请输入公司服务宗旨" required>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary" id="register">注册</button>
					<input type="reset" value="重置" class="btn btn-primary"/>
					<button type="button" class="btn btn-default" onclick="history.back();">返 回</button>
				</div>
			</div>
		</form>
	</div>
	    <script>
	    	function selectCode(obj){
	    		var valueCode = document.getElementById("addcode").value
	    		
	    		if(valueCode!=null && valueCode!="" ){
	    		$.get('<%=request.getContextPath()%>/CompanyServlet?command=selectCode&valueCode='+valueCode+'&time=' + new Date().getTime(), function(text){
				     // 如果是成功了就在页面上删除当前a标签所在的tr，如果不成功给出提示
				     if (text == 'no') {
				    	layer.msg('账号已存在!', {time: 2000, icon: 5});
				    	document.getElementById("register").disabled=true;
				     } else if(text =='yes') {
				    	layer.msg('该账号可以使用!', {time: 2000, icon: 6});
				    	document.getElementById("register").disabled=false;
				     }
				  });
	    		}else{
	    			layer.msg('账号不能为空!', {time: 2000, icon: 5});
	    		}
	    	}
	    
	    </script>
    </body>
</html>
